package com.zwh.rocketmq.web;

import java.util.HashMap;

import org.apache.rocketmq.client.producer.SendResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.zwh.rocketmq.MQProducerUtils;

@RestController
@RequestMapping("/rocketmq")
public class RocketMQController {

    @Autowired
    private MQProducerUtils mqProducerUtils;

    @GetMapping("/sendTag")
    public SendResult sendTag() {
        SendResult sendResult = mqProducerUtils.sendTagMsg("带有tag的字符消息");
        return sendResult;
    }

    @GetMapping("/sendMsg")
    public SendResult sendMsg() {
        HashMap<String, Object> haha = new HashMap<>();
        haha.put("aa", 123);
        SendResult sendResult = mqProducerUtils.sendMsg("RLT_TEST_TOPIC", "tag1", haha, "123");
        return sendResult;
    }


}
